#ifndef CMIDPOINTGEN_H
#define CMIDPOINTGEN_H
#pragma once

class TwMidPointNoise
{
public:


	enum
	{
		k_tableSize = 256
	};



    TwMidPointNoise();
    ~TwMidPointNoise();


	float noise(int x, int y, int sizeX, int sizeY, float falloff);



private:

	float m_floatTable[k_tableSize];
	unsigned char m_indexTable[k_tableSize];


    explicit TwMidPointNoise(const TwMidPointNoise& Src);
    TwMidPointNoise& operator=(const TwMidPointNoise& Src);

	void setup();

	float randomValue(int x, int y, float range);

	float recursiveDisplacement(
		int target_x, int target_y,
		int min_x, int min_y,
		int max_x, int max_y,
		float A, float B, float C, float D,
		float range,
		float falloff);

};


#endif  
